// const isPrime = (num: number): boolean => {
//   for (let i = 2; i < num; i++) {
//     if (num % i === 0) {
//       return false;
//     }
//   }

//   return true;
// };

const isPrime = (num: number): boolean => {
  const sqrt = Math.sqrt(num);

  for (let i = 2; i <= sqrt; i++) {
    if (num % i === 0) {
      return false;
    }
  }

  return true;
};

console.log(isPrime(5));
console.log(isPrime(7));
console.log(isPrime(9));
console.log(isPrime(15));
